<template>
  <div class="c-bg-white c-ph40">
    <div class="c-fs32 c-fc-sxblack c-textAlign-c c-pt180 c-lh60">{{topicName}}</div>
    <div class="c-fs22 c-fc-gray c-textAlign-c c-mt40">{{wrongNum}}题</div>
    <div class="c-w60 c-m-0auto c-fs28 c-fc-white c-hh80 c-textAlign-c c-flex-row c-flex-center theme-bg c-mt120 c-br10 c-mb40" @click="startTest">开始练习</div>
    <div class="c-w60 c-m-0auto c-fs28 c-fc-white c-hh80 c-textAlign-c c-flex-row c-flex-center theme-bg c-br10" @click="watchWrong">查看题目</div>
  </div>
</template>

<script>
import { utilJs } from "@/utils/common.js"
export default {
  name: "ItemWrongEnty",
  components: {

  },
  props: [],
  data() {
    return {
      theme: localStorage.getItem("colorName") ? localStorage.getItem("colorName") : 'mb5_default',
      rId:'',
      type:'',
      topicName:'',
      wrongNum :'',
      libraryId:'',
    };
  },
  created() {
    utilJs.appShare(this);
  },
  activated() {
    setDocumentTitle("开始测试");// eslint-disable-line
    this.$store.commit('updateLoadingStatus', {
      isLoading: false
    });
    this.rId = this.$route.query.rId
    this.type = this.$route.query.type
    this.topicName = this.$route.query.topicName;
    this.wrongNum = this.$route.query.wrongNum;
    this.libraryId = this.$route.query.libraryId;
    this.wechatShare();
  },
  deactivated() {
  },
  mounted() {

   },
  methods: {
    startTest() {
      let $this = this
      let data = {
        libraryId: $this.libraryId,
        type: $this.type,
        rId: $this.rId,
      };
       utilJs.postMethod(`${global.apiurl}itemBank/takePartIn`, data, function (
        res
      ) {
        let queryT = {
          libraryId: $this.libraryId,
          type: $this.type,
          goOnNum: 1,
          isFromPractice:$this.$route.query.isFromPractice || ''
        }
        if ($this.type == 5 || $this.type == 3) {
          queryT.rId = $this.rId;
        }
        $this.$routerGo($this, "push", {
          path: '/homePage/itemBank/questionAnswer',
          query: queryT
        })
      })
    },
    watchWrong() {
      this.$routerGo(this, "replace", {
        path: "/member/myWrongTopic/examWrongTopic/itemWrongAnswerAnalyze",
        query: { rId:this.rId}
      });
    },
    //分享
    wechatShare: function () {
      utilJs.wechatConfig("", "", "", "", function () { });
    },
    //手机端分享
    appShare: function () {
      utilJs.appShareTrue("", "", "", "");
    }
  }
};
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->

<style scoped>
</style>
